package edu.msg.jthr.web.util;

import java.util.List;

import edu.msg.jthr.backend.model.UserGroup;

public class RoleAssembler {

	private static final String GENERAL = "general";
	private static final String DIRDEPHR = "dirdephr";
	private static final String RECRUITER = "recruiter";
	private static final String VIEWER = "viewer";

	public synchronized static String getRole(List<UserGroup> userGroups) {
		for (UserGroup ug : userGroups) {
			String roleName = ug.getRoleName();
			switch (roleName) {
			case "Admin":
				return GENERAL;
			case "Director General":
				return GENERAL;
			case "Director Departament":
				return DIRDEPHR;
			case "Director HR":
				return DIRDEPHR;
			case "Recruiter":
				return RECRUITER;
			default:
				break;
			}
		}
		return VIEWER;
	}
}
